<?php
namespace App\Http\Controllers\Banners;
use Illuminate\Http\Request;
use App\Http\Controllers\BaseApiController;
use App\Services\Banners\BannersService;
use Illuminate\Support\Facades\Validator;
class BannersController extends BaseApiController{
    private $service;
    public function __construct(BannersService $service){
        //继承基类的构造方法
        parent::__construct();
        //依赖注入service
        $this->service=$service;
    }

    /**
     * @return string
     * 轮播图展示
     */
    public function sel(Request $request)
    {
        $rule=['banner_type' => "required|integer|max:9999999999"];
        if($error=$this->validate($rule,$request)){
            return $error;
        }
        //根据类型去查询
        $data=$request->get("banner_type");
        return $this->service->sel($data);
    }
}